home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / keymas_1 / keymas~1.txt < prev    next >
Text File  |  1998-05-29  |  6KB  |  72 lines

  1. The Keymaster OCX is an ActiveX control used to make registry editing easy.  It effectively wraps the Registry APIs in an easy to use format.  A basic knowledge of the registry is helpful in using this control.
  2.  
  3. This control has been is made for any Win32 environment, however it has only been tested on Windows NT 4.0 and Windows 95.
  4.  
  5. I don't have a fancy install program yet, so installation is somewhat manual.  Once you've extracted the zip file, (which you should have done already to be reading this) move Msvcrt40.dll, Mfc42.dll, Olepro32.dll, Keymaster.ocx and regocx32.exe into your Windows\System\ directory.  Then from a command line, or from the run menu, use regocx32 to register the controls (ie regocx32.exe Msvcrt40.dll).  Move the files and register them even if you think they are already installed on your machine to make sure they are the correct version.  Once you've done this, Keymaster should show up in your Visual Basic components list.  You can now add it and run in just like any other control.
  6.  
  7. Since tweaking the registry is complex and tricky, I decided to write this ocx in C++ 5.0 to afford myself as much precision and error handling capability as possible.  If you have any comments or suggestions for future upgrades of this product, please feel free to email me at dirtdart@apex.net.  Or snail-mail me at the address listed below.
  8.  
  9. Properties:
  10.     All properties in the Keymaster should be set by code instead of in the properties box.
  11.  
  12. RootKey - This value is a long integer reperesenting one of the Root keys defined in the Keymaster.bas included with this control.
  13.  
  14. SubKey - This is a string value representing the Name of the Subkey that you are manipulating.  It can be a direct subkey or several levels down.  ie:
  15.  
  16.     Keymaster1.Subkey = "SOFTWARE"
  17.     Keymaster1.Subkey = "SOFTWARE\Microsoft\Office97"
  18.  
  19. ValueName - This is a string value that should be set to the name of the value you will be manipulating.  If it is left empty, Keymaster will manipulate the default value.
  20.  
  21. Value - When Querying the registry, this will hold the returned value.  When setting a registry value, this should be set to the value being passed into the registry.  Regardless of the type of data being sent or received, this will always be a string value.
  22.  
  23. ValueType - This should only be changed when setting a registry value.  It should then be set to one of the registry value constants defined in Keymaster.bas
  24.  
  25. LastError - This value should never be set.  If there is an error encountered in one of the registry subroutines, and ERR_EXTENDED_INFORMATION is returned, this value will hold the verbose statement for the error encountered.
  26.  
  27. Methods:
  28.  
  29. CreateKey - This value is used to create a new Subkey.  It can be used to define subkeys up to four levels deep at one time.  It will return 0 on success or one of the error codes listed at the bottom of this document on failure.
  30.  
  31. DeleteKey - This is used to delete a registry key.  This subroutine will not work on root keys.  Special note:  If you are using Windows 95, this will delete the subkey and all subkeys under it.  However, if you are using Windows NT, and there are subkeys defined under the key, an error will be returned.  You must delete all subkeys to the key before deleting the key itself.  This method will return 0 on success, or one of the error codes listed at the bottom of this document on failure.
  32.  
  33. DeleteValue - This is similar to DeleteKey, except that it deletes a value associated with a key instead of the key itself.  It will return 0 on success or one of the error codes listed at the bottom of this document on failure.
  34.  
  35. GetValue - This method is used to retrieve data from the registry.  Data returned by this method will be stored in the Value Property.  This method will return 0 on success or one of the error codes listed at the bottom of this document on failure.
  36.  
  37. SetValue - This will take the value stored in the Value property and store it in the Key specified by SubKey.  It will return 0 on success or one of the error codes listed at the bottom of this document on failure.  If no ValueName is set, the default value is set for the key.
  38.  
  39. Error codes:
  40.  
  41. All error codes are defined in the Keymaster module.  They are defined here to show what will cause a specific error code.
  42.  
  43. ERR_NO_ROOT - This error code will be returned by any function if no RootKey value is set.
  44.  
  45. ERR_NO_SUBKEY - This error code will be returned by any function if no SubKey value is set.
  46.  
  47. ERR_NO_VALUE - This error code will be returned by SetValue if no value is specified.
  48.  
  49. ERR_NO_VALUE_NAME - This error code will be retuned by GetValue,  or DeleteValue if no ValueName value is set.
  50.  
  51. ERR_SUBKEY_EXISTS - This error code will be returned by DeleteKey under Windows NT if a subkey exists under the key being deleted.
  52.  
  53. ERR_EXTENDED_INFORMATION - This error code will be returned by any function if any situation occurs not listed in the error codes above.  The extended error information will be stored in LastError.
  54.  
  55. Remarks:
  56.  
  57. Before doing any work with the registry, you should always make a backup.  This control will not manipulate the root classes of the registry, but it would be simple to destroy other important information if not careful.
  58.  
  59. All HKEY_ and REG_ constants are defined in the Win32Api.txt that comes with Visual Basic.  However, the ERR_ constants should be used exactly as they are listed in Keymaster.bas.
  60.  
  61. This module is provided as-is with no warranties, express or implied.  The author will not be held responsible for lost data or damage to hardware or software, either direct or indirect caused by use or misuse of this control.  This control and its documentation, including Keymaster.bas can be freely distributed in its original format.  Editing or changing of the contents is expressly prohibited.  If you like this control and find it useful, help me out in my programming efforts by sending $10.00 to:
  62.  
  63. Drew Burchett
  64. 2015 Clark Line Road
  65. Paducah, KY 42003
  66.  
  67. If you have any questions, comments, or suggestions, email me at dirtdart@apex.net, or look for me at the Experts Exchange (http://www.experts-exchange.com).  I can't promise to answer all questions, but I will try to reply to whatever I can.
  68.  
  69. Thanks for trying out my controls.
  70.  
  71. Drew
  72.